#!/usr/local/bin/python3
# -*- coding: UTF-8 -*-
"""
@author:apple
@file:quick_sort.py
@time:2022/02/18
"""


def quick_sort(nums:list):
    ...
    if len(nums) < 2:
        return nums
    povit = nums.pop()

    small = []
    big = []

    for val in nums:
        (small if val < povit else big).append(val)

    return quick_sort(small) + [povit] + quick_sort(big)



if __name__ == '__main__':
    pass
    print(quick_sort([2, 1, 3, 4, 9, 7]))